-- This creates a visits-level trace data set from the SQL database
SELECT v.person_id, wave, v.id, v.score_domain, loc_nat
FROM visits_u_news_us v
left join visits_u_url_per_person_per_day vu on vu.id = v.id
left join domains_news_us d on d.score_domain = v.score_domain
where wave between 1 and 3 and loc_nat is not null